<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Models\Tieba;
use Illuminate\Support\Facades\Log;

class GetIndex extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'tieba:get-index';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '抓取首页';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(Tieba $tieba)
    {
        $this->info("开始执行...");
        Log::info('执行了计划任务');
        $tieba->DownIndexHtml();
        $this->info("任务结束");
    }
}
